Change Case - V1
Jonathan Collins
www.vgration.com
jcollins@vgration.com

This little mod will make it to where your Product Name will be changed to proper Case.
I was having a problem that one of my distributors had there products in all caps and it
was a pain to change the case by hand.

BACKUP BACKUP BACKUP

To get this to work make the following changes:

shop/admin/products.php

Add anywhere in the head:

<script type="text/javascript">
String.prototype.toProperCase = function()
{
  return this.toLowerCase().replace(/^(.)|\s(.)/g, 
      function($1) { return $1.toUpperCase(); });
}
</script>

in admin/includes/modules/product/collect_info.php

find

<?php echo zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . zen_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? stripslashes($products_name[$languages[$i]['id']]) : zen_get_products_name($pInfo->products_id, $languages[$i]['id'])), zen_set_field_length(TABLE_PRODUCTS_DESCRIPTION, 'products_name')); ?>

change to

<?php echo zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;' . zen_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? stripslashes($products_name[$languages[$i]['id']]) : zen_get_products_name($pInfo->products_id, $languages[$i]['id'])), zen_set_field_length(TABLE_PRODUCTS_DESCRIPTION, 'products_name')." onclick=\"this.value = this.value.toProperCase()\""); ?>

Thats it

I have included the files so you can use a file compare utility

Thanks and if you find this useful go to my site and buy something ;)